package com.lb.statck.controller;

import com.lb.statck.common.result.Result;
import com.lb.statck.pojo.vo.CategoryVo;
import com.lb.statck.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
 @RestController
@RequestMapping("/api/category")
public class CategoryController {
    @Autowired
    private CategoryService categoryService;

    @PostMapping("/get")
    public Result getCategory() {
        List<CategoryVo> all = categoryService.getAll();
        Result result = new Result();
        result.setData(all);
        result.setCode(200);
        return result;
    }

}
